<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="box">hello box <b>!!</b></div>
    <script>
      /*
        outerHTML
        1. 标签对象才有的属性
        2. 获取标签的文本内容，内容包含HTML和标签本身
        3. 使用其他内容，替换标签，如果内容中有html标签，那么html标签会被解析，之前标签会被清除
        */
      const box = document.getElementById("box");
      console.log(box.outerHTML);
      setTimeout(() => {
        box.outerHTML = "hello <i> lili </i> <b> !!</b>";
        console.log(box);
      }, 3000);
    </script>
  </body>
</html>
